package com.whsxt.exception;

import com.whsxt.common.CodeMsg;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 自定义异常类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BusinessException extends RuntimeException{
    // 异常码
    private String code;

    private String msg;

    public BusinessException(CodeMsg codeMsg, Object... params){
        this.code = codeMsg.code;
        this.msg = String.format(codeMsg.msg, params);
    }
}
